object DMOsoby: TDMOsoby
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  Height = 341
  Width = 548
  object ADQFizyczne: TADQuery
    SQL.Strings = (
      'select O.*, '#39'nowa'#39' as stan, '#39'1'#39' as sort'
      'from OsobyView O'
      'where O.inKRS = :krs'
      '  and O.pub_dodany = :pub'
      '  and O.data_dodany = :data'
      '  and O.boFizyczna = 1'
      'union'
      'select O.*, '#39'skasowana'#39' as stan, '#39'2'#39' as sort'
      'from OsobyView O'
      'where O.inKRS = :krs'
      '  and O.pub_skasowany = :pub'
      '  and O.data_skasowany = :data'
      '  and O.boFizyczna = 1'
      'union'
      'select O.*, '#39'jest'#39' as stan, '#39'3'#39' as sort'
      'from OsobyView O'
      'where O.inKRS = :krs'
      
        ' and (O.data_dodany < :data or (O.data_dodany = :data and O.pub_' +
        'dodany < :pub))'
      
        ' and ((O.data_skasowany > :data or (O.data_skasowany = :data and' +
        ' O.pub_skasowany > :pub)) '
      #9'  or '
      '      (O.pub_skasowany is null and O.data_skasowany is null)) '
      ' and O.boFizyczna = 1'
      'order by O.chRodzajOsoby, sort, O.chNazwisko')
    Left = 40
    Top = 16
    ParamData = <
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end>
  end
  object ADQPrawne: TADQuery
    SQL.Strings = (
      'select O.*, '#39'nowa'#39' as stan, '#39'1'#39' as sort'
      'from OsobyView o'
      'where O.inkrs = :krs'
      '  and O.pub_dodany = :pub'
      '  and O.data_dodany = :data'
      '  and O.boFizyczna = 0'
      'union'
      'select O.*, '#39'skasowana'#39' as stan, '#39'2'#39' as sort'
      'from OsobyView o'
      'where O.inkrs = :krs'
      '  and O.pub_skasowany = :pub'
      '  and O.data_skasowany = :data'
      '  and O.boFizyczna = 0'
      'union'
      'select O.*, '#39'jest'#39' as stan, '#39'3'#39' as sort'
      'from OsobyView o'
      'where O.inkrs = :krs'
      
        ' and (O.data_dodany < :data or (O.data_dodany = :data and O.pub_' +
        'dodany < :pub))'
      
        ' and ((O.data_skasowany > :data or (O.data_skasowany = :data and' +
        ' O.pub_skasowany > :pub)) '
      ' '#9'  or '
      '     (O.pub_skasowany is null and O.data_skasowany is null)) '
      ' and O.boFizyczna = 0'
      'order by O.chRodzajOsoby, sort, O.chNazwa')
    Left = 37
    Top = 80
    ParamData = <
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end>
  end
  object ADQRodzajOsoby: TADQuery
    SQL.Strings = (
      'select * '
      'from RodzajeOsob '
      'order by inKolejnosc')
    Left = 152
    Top = 16
  end
  object ADQFunkcjaOsoby: TADQuery
    SQL.Strings = (
      'select * '
      'from FunkcjeOsob '
      'order by chFunkcjaOsoby')
    Left = 152
    Top = 80
  end
  object ADQDodajOsobe: TADQuery
    Left = 328
    Top = 16
  end
  object ADQUsunOsobe: TADQuery
    Left = 328
    Top = 80
  end
  object ADQSprawdzDodatki: TADQuery
    SQL.Strings = (
      
        'select OD.idOsobyDodatki, M1.chPublikator as pub1, M2.chPublikat' +
        'or as pub2'
      'from OsobyDodatki od'
      'left outer join Metryki m1 on OD.idMetryki = M1.idMetryki'
      'left outer join Metryki m2 on OD.idMetrykikasuj = M2.idMetryki'
      'where OD.idOsoby = :idOsoby'
      
        '  and ((select chPublikator16 from Metryki where idMetryki = OD.' +
        'idMetrykikasuj) > (select chPublikator16 from Metryki where idMe' +
        'tryki = :idMetryki)'
      
        '   or (select chPublikator16 from Metryki where idMetryki = OD.i' +
        'dMetryki) > (select chPublikator16 from Metryki where idMetryki ' +
        '= :idMetryki))')
    Left = 328
    Top = 144
    ParamData = <
      item
        Name = 'IDOSOBY'
        ParamType = ptInput
      end
      item
        Name = 'IDMETRYKI'
        ParamType = ptInput
      end
      item
        Name = 'IDMETRYKI'
        ParamType = ptInput
      end>
  end
  object ADQZnajdzOsobe: TADQuery
    Left = 64
    Top = 200
  end
  object ADQZnajdzOsobeKRS: TADQuery
    Left = 64
    Top = 256
  end
  object ADQidRodzajuOsoby: TADQuery
    SQL.Strings = (
      'select idRodzajuOsoby '
      'from RodzajeOsob '
      'where chRodzajOsoby = :rodzaj')
    Left = 200
    Top = 200
    ParamData = <
      item
        Name = 'RODZAJ'
        ParamType = ptInput
      end>
  end
  object ADQidFunkcjiOsoby: TADQuery
    SQL.Strings = (
      'select idFunkcjiOsoby '
      'from FunkcjeOsob '
      'where chFunkcjaOsoby = :funkcja')
    Left = 200
    Top = 256
    ParamData = <
      item
        Name = 'FUNKCJA'
        ParamType = ptInput
      end>
  end
  object ADQZapiszOsobe: TADQuery
    Left = 328
    Top = 200
  end
end
